package com.hanamaki.method;

import java.util.Scanner;

public class Demo06 {

    /**
     * scanner
     * a
     * +
     * b
     * enter
     * switch
     * + - * /
     * add   less  mult  chu
     *
     * @param args
     */
    public static void main(String[] args) {

        System.out.println("计算结果：" + calc());

    }

    static int calc() {
        int result = 0;
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入计算的第一个数字:");
        int a = scanner.nextInt();
        System.out.println("请输入运算符号:");
        String f = scanner.next();
        System.out.println("请输入计算的第二个数字:");
        int b = scanner.nextInt();

        switch (f) {
            case "+":
                result = add(a, b);
                break;
            case "-":
                result = less(a, b);
                break;
            case "*":
                result = mlu(a, b);
                break;
            case "/":
                result = chu(a, b);
                break;
        }

        return result;
    }

    static int add(int a, int b) {
        return a + b;
    }

    static int less(int a, int b) {
        return a - b;
    }

    static int mlu(int a, int b) {
        return a * b;
    }

    static int chu(int a, int b) {
        return a / b;
    }




}
